<template>
  <div>
    <div class="big">
      <p>账单</p>
      <button class="all">全部账单</button>
      <span>2021年12月</span>
    </div>
    <ul class="title">
      <li>项目</li>
      <li>时间</li>
      <li>收支情况</li>
    </ul>
    <ul class="content">
      <li v-for="item in arr" :key="item.Id">
        <span>{{ item.goodsWages }}</span>
        <span>{{ item.Stime }}</span>
        <span>{{ item.goodsSale }}</span>
      </li>
    </ul>
  </div>
</template>

<script>
import service from "../../sale/moke/salePay";
import { onMounted, ref } from "vue";

export default {
  setup(props, context) {
    let arr = ref([]);
    let ss = ref([]);
    onMounted(async () => {
      const res = await service.getData();
      arr.value = res.data.data;
      console.log(arr.value);
      ss.value = arr.value.reduce((sum, e) => sum + e.goodsSale, 0);
      console.log(ss.value);
      context.emit("hhh", ss.value);
    });
    return {
      arr,
      ss,
    };
  },
  // data() {
  //   return {
  //     arr2: [],
  //   };
  // },
};
</script>

<style lang="less" scoped>
.big {
  p {
    font-size: 20px;
    height: 40px;
    line-height: 40px;
  }
  .all {
    width: 80px;
    height: 30px;
    background: #00a0e9;
    color: #fff;
    border: none;
    border-radius: 15px;
  }
  span {
    font-size: 14px;
    margin: 10px 0;
    display: block;
  }
}
.title {
  width: 100%;
  height: 40px;
  display: flex;
  li {
    flex: 1;
    width: 100%;
    height: 100%;
    text-align: center;
    color: #909399;
  }
}
.content {
  width: 100%;
  height: 450px;
  overflow: auto;

  li {
    display: flex;
    width: 100%;
    height: 35px;
    text-align: center;
    color: #909399;

    span {
      display: inline-block;
      flex: 1;
    }
  }
}
</style>
